# -*- coding: utf-8 -*-
# @Time : 2023-12-19
# @Author : ZhiLan Qiu
# @Site : 
# @File : services/deduplication.py
# @Function: deduplication function
# # @Describe: ---

#要求用户输入参考列字段，例如 第一列，则只使用第一列进行每一行的数据比较查看是否重复
#输入数据格式为  中文的列名或索引
class deduplication:
    def dedup(self,fileArray,information):
        fileArrayMiao = fileArray
        index = 0
        indexChild = 0
        for line in fileArray[0]:
            if information in line: index = indexChild
            indexChild+=1

        dedupArray = []
        dedupIndex = 0

        for line in fileArray[0:len(fileArray)-1]:
            # print(line[index] in dedupArray)
            if line[index] in dedupArray:
                fileArrayMiao.remove(line)
            else:
                dedupArray.append(line[index])
            
        return fileArrayMiao


